﻿namespace Vdc.Grid
{
    using Vdc.Grid.Design;
    using System;
    using System.ComponentModel;

    [TypeConverter(typeof(GridClientSideEventsConverter))]
    public class GridClientSideEvents : GridPersistentObject, ICloneable
    {
        public object Clone()
        {
            return new GridClientSideEvents { 
                ExposeSender = this.ExposeSender, OnBeforeClientAdd = this.OnBeforeClientAdd, OnBeforeClientCancelAdd = this.OnBeforeClientCancelAdd, OnBeforeClientCancelEdit = this.OnBeforeClientCancelEdit, OnBeforeClientDelete = this.OnBeforeClientDelete, OnBeforeClientEdit = this.OnBeforeClientEdit, OnBeforeClientInsert = this.OnBeforeClientInsert, OnBeforeClientSelect = this.OnBeforeClientSelect, OnBeforeClientUpdate = this.OnBeforeClientUpdate, OnClientAdd = this.OnClientAdd, OnClientCallback = this.OnClientCallback, OnClientCallbackError = this.OnClientCallbackError, OnClientCancelAdd = this.OnClientCancelAdd, OnClientCancelEdit = this.OnClientCancelEdit, OnClientDblClick = this.OnClientDblClick, OnClientDelete = this.OnClientDelete, 
                OnClientEdit = this.OnClientEdit, OnClientExportFinish = this.OnClientExportFinish, OnClientExportStart = this.OnClientExportStart, OnClientInsert = this.OnClientInsert, OnClientPopulateControls = this.OnClientPopulateControls, OnClientSelect = this.OnClientSelect, OnClientUpdate = this.OnClientUpdate, OnFiltering = this.OnFiltering, OnPopulatingFilterFields = this.OnPopulatingFilterFields
             };
        }

        object ICloneable.Clone()
        {
            return this.Clone();
        }

        [Bindable(true), Description("If set to true, the client-side events will expose a parameter for accessing the grid that raised the event."), Category("Client-Side Events"), DefaultValue(false)]
        public bool ExposeSender
        {
            get
            {
                object obj2 = this.ViewState["ExposeSender"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                this.ViewState["ExposeSender"] = value;
            }
        }

        [Bindable(true), Category("Client-Side Events"), DefaultValue(""), Description("Client-side function to be executed before a new record is added.")]
        public string OnBeforeClientAdd
        {
            get
            {
                object obj2 = this.ViewState["OnBeforeClientAdd"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnBeforeClientAdd"] = value;
            }
        }

        [Description("Client-side function which is executed before the adding of a new record is canceled."), DefaultValue(""), Bindable(true), Category("Client-Side Events")]
        public string OnBeforeClientCancelAdd
        {
            get
            {
                object obj2 = this.ViewState["OnBeforeClientCancelAdd"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnBeforeClientCancelAdd"] = value;
            }
        }

        [Description("Client-side function which is executed before the editing for a record is canceled."), DefaultValue(""), Bindable(true), Category("Client-Side Events")]
        public string OnBeforeClientCancelEdit
        {
            get
            {
                object obj2 = this.ViewState["OnBeforeClientCancelEdit"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnBeforeClientCancelEdit"] = value;
            }
        }

        [Bindable(true), Category("Client-Side Events"), DefaultValue(""), Description("Client-side function to be executed before a record is deleted.")]
        public string OnBeforeClientDelete
        {
            get
            {
                object obj2 = this.ViewState["OnBeforeClientDelete"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnBeforeClientDelete"] = value;
            }
        }

        [Description("Client-side function to be executed before a record is edited."), DefaultValue(""), Bindable(true), Category("Client-Side Events")]
        public string OnBeforeClientEdit
        {
            get
            {
                object obj2 = this.ViewState["OnBeforeClientEdit"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnBeforeClientEdit"] = value;
            }
        }

        [DefaultValue(""), Description("Client-side function to be executed before a new record is inserted."), Category("Client-Side Events"), Bindable(true)]
        public string OnBeforeClientInsert
        {
            get
            {
                object obj2 = this.ViewState["OnBeforeClientInsert"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnBeforeClientInsert"] = value;
            }
        }

        [Bindable(true), Description("Client-side function to be executed before a record is selected."), Category("Client-Side Events"), DefaultValue("")]
        internal string OnBeforeClientSelect
        {
            get
            {
                object obj2 = this.ViewState["OnBeforeClientSelect"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnBeforeClientSelect"] = value;
            }
        }

        [Description("Client-side function to be executed before a record is updated."), Bindable(true), Category("Client-Side Events"), DefaultValue("")]
        public string OnBeforeClientUpdate
        {
            get
            {
                object obj2 = this.ViewState["OnBeforeClientUpdate"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnBeforeClientUpdate"] = value;
            }
        }

        [Category("Client-Side Events"), Bindable(true), DefaultValue(""), Description("Client-side function which is executed when a record is put in add mode.")]
        public string OnClientAdd
        {
            get
            {
                object obj2 = this.ViewState["OnClientAdd"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnClientAdd"] = value;
            }
        }

        [DefaultValue(""), Description("Client-side function to be executed after a callback."), Bindable(true), Category("Client-Side Events")]
        public string OnClientCallback
        {
            get
            {
                object obj2 = this.ViewState["OnClientCallback"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnClientCallback"] = value;
            }
        }

        [Description("Client-side function to be executed when an error appears after a callback."), Bindable(true), Category("Client-Side Events"), DefaultValue("")]
        public string OnClientCallbackError
        {
            get
            {
                object obj2 = this.ViewState["OnClientCallbackError"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnClientCallbackError"] = value;
            }
        }

        [Description("Client-side function which is executed after the adding of a new record is canceled."), Bindable(true), DefaultValue(""), Category("Client-Side Events")]
        public string OnClientCancelAdd
        {
            get
            {
                object obj2 = this.ViewState["OnClientCancelAdd"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnClientCancelAdd"] = value;
            }
        }

        [Category("Client-Side Events"), Bindable(true), DefaultValue(""), Description("Client-side function which is executed after the editing for a record is canceled.")]
        public string OnClientCancelEdit
        {
            get
            {
                object obj2 = this.ViewState["OnClientCancelEdit"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnClientCancelEdit"] = value;
            }
        }

        [Description("Client-side event which fires when a record is double-clicked."), Bindable(true), Category("Client-Side Events"), DefaultValue("")]
        public string OnClientDblClick
        {
            get
            {
                object obj2 = this.ViewState["OnClientDblClick"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnClientDblClick"] = value;
            }
        }

        [Category("Client-Side Events"), Bindable(true), DefaultValue(""), Description("Client-side function to be executed when a record is deleted.")]
        public string OnClientDelete
        {
            get
            {
                object obj2 = this.ViewState["OnClientDelete"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnClientDelete"] = value;
            }
        }

        [Description("Client-side function which is executed when a record is edited."), DefaultValue(""), Bindable(true), Category("Client-Side Events")]
        public string OnClientEdit
        {
            get
            {
                object obj2 = this.ViewState["OnClientEdit"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnClientEdit"] = value;
            }
        }

        [Category("Client-Side Events"), Bindable(true), Description("Client-side event which fires when the grid exporting is finished."), DefaultValue("")]
        public string OnClientExportFinish
        {
            get
            {
                object obj2 = this.ViewState["OnClientExportFinish"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnClientExportFinish"] = value;
            }
        }

        [Description("Client-side event which fires when the grid exporting is started."), Bindable(true), Category("Client-Side Events"), DefaultValue("")]
        public string OnClientExportStart
        {
            get
            {
                object obj2 = this.ViewState["OnClientExportStart"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnClientExportStart"] = value;
            }
        }

        [Description("Client-side function to be executed when a new record is inserted."), Category("Client-Side Events"), DefaultValue(""), Bindable(true)]
        public string OnClientInsert
        {
            get
            {
                object obj2 = this.ViewState["OnClientInsert"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnClientInsert"] = value;
            }
        }

        [Category("Client-Side Events"), Bindable(true), DefaultValue(""), Description("Client-side function which is executed when the controls for adding/editing records are populated with data.")]
        public string OnClientPopulateControls
        {
            get
            {
                object obj2 = this.ViewState["OnClientPopulateControls"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnClientPopulateControls"] = value;
            }
        }

        [Description("Client-side function to be executed when a record is selected."), DefaultValue(""), Category("Client-Side Events"), Bindable(true)]
        public string OnClientSelect
        {
            get
            {
                object obj2 = this.ViewState["OnClientSelect"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnClientSelect"] = value;
            }
        }

        [Description("Client-side function to be executed when a record is updated."), Bindable(true), DefaultValue(""), Category("Client-Side Events")]
        public string OnClientUpdate
        {
            get
            {
                object obj2 = this.ViewState["OnClientUpdate"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnClientUpdate"] = value;
            }
        }

        [Bindable(true), Description("Client-side event which fires before the filters are applied."), Category("Client-Side Events"), DefaultValue("")]
        public string OnFiltering
        {
            get
            {
                object obj2 = this.ViewState["OnFiltering"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnFiltering"] = value;
            }
        }

        [DefaultValue(""), Description("Client-side event which fires when the filter fields are populated with data."), Bindable(true), Category("Client-Side Events")]
        public string OnPopulatingFilterFields
        {
            get
            {
                object obj2 = this.ViewState["OnPopulatingFilterFields"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                this.ViewState["OnPopulatingFilterFields"] = value;
            }
        }
    }
}

